package com.zmx.core.dto;

import lombok.Data;
import lombok.ToString;

import java.io.Serializable;

/**
 * @Description: 执行任务实体
 * @ClassName: RequestDataInfo
 * @Author zhaomxr
 * @Date 2021-12-17 15:28
 */
@Data
@ToString
public class RequestDataInfo implements Serializable {

    /**
     * 请求类型 method执行方法/log日志
     */
    private String type;

    /**
     * 加密验证秘钥
     */
    private String verification;

    /**
     * 目标对象bean
     */
    private String value;

    /**
     * 执行周期
     */
    private String cycle;

    /**
     * 参数
     */
    private Object params;

    /**
     * 是否只执行一次 默认为否，即按照定时周期执行
     */
    private boolean onlyOne = false;

    /**
     * 为达到性能最优，声明此任务可延时执行 默认为否，即立刻执行
     */
    private boolean delayed = false;

    public RequestDataInfo() {
        this.type = "method";
    }

    public RequestDataInfo(String verification, String cycle) {
        this.verification = verification;
        this.cycle = cycle;
    }

    public RequestDataInfo(String verification, String cycle, Object params) {
        this.verification = verification;
        this.cycle = cycle;
        this.params = params;
    }

    public RequestDataInfo(String verification, String cycle, Object params, boolean onlyOne) {
        this.verification = verification;
        this.cycle = cycle;
        this.params = params;
        this.onlyOne = onlyOne;
    }

    public RequestDataInfo(String verification, String cycle, Object params, boolean onlyOne, boolean delayed) {
        this.verification = verification;
        this.cycle = cycle;
        this.params = params;
        this.onlyOne = onlyOne;
        this.delayed = delayed;
    }
}
